<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Program extends CI_Controller {

	public function __construct()
    {
        parent::__construct();
        $this->load->model('film');
        $this->load->model('loginmodel');
    }
    public function index()
	{
		$logat = $this->loginmodel->este_logat();
		$data['titlu'] = 'Star Cinema | Program';
		$logat = $this->loginmodel->este_logat();
		$data['logat'] = $logat;
		if($logat)
		{
			$data['nume'] = $this->session->userdata('nume');
			$data['prenume'] = $this->session->userdata('prenume');
		}

		$data2['rez'] = $this->film->get_results();
		$filme = array();

		foreach($data2['rez'] as $film)
		{
			$f = array();
			$f['id'] = $film->id;
			$f['nume'] = $film->titlu;
			$f['orar'] = $this->film->get_movie_program($film->id);
			$f['poster'] = $film->poster;

			$data2['filme'][] = $f;
		}

		$this->load->view('home/header', $data);
		$this->load->view('program/content', $data2);
		$this->load->view('home/footer');
	}
}
?>